legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
shape=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
#scale_y_continuous(breaks = seq(0, 0.4, by = 0.05), limits = c(-0.02,0.28)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
shape=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
pal <- brewer.pal(3, "Blues")
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
#scale_y_continuous(breaks = seq(0, 0.4, by = 0.05), limits = c(-0.02,0.28)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(palette="Blues", labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
#scale_y_continuous(breaks = seq(0, 0.4, by = 0.05), limits = c(-0.02,0.28)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2,3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
#scale_y_continuous(breaks = seq(0, 0.4, by = 0.05), limits = c(-0.02,0.28)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
#scale_y_continuous(breaks = seq(0, 0.4, by = 0.05), limits = c(-0.02,0.28)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra2.pdf", height=13, width=15, units="cm")
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3.2)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra2.pdf", height=13, width=15, units="cm")
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_manual(values = c("dashed", "solid"), labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_manual(values = c("dotted", "solid"), labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_manual(values = c(2,1), labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra2.pdf", height=13, width=15, units="cm")
#Load libraries
setwd(dirname(rstudioapi::getSourceEditorContext()$path)) #path is where this code is saved - data must be in the same folder
library(readxl)
library(dplyr)
library(reshape)
library(ggplot2)
library(RColorBrewer)
#library(scales)
#OPEN FILES
df_p1 <- read_excel('Exp 20250409 - AMTA with Imidazole Pt4.xlsx','Plate 1 Transposed')
df_p2 <- read_excel('Exp 20250411 - AMTA with Imidazole Pt5.xlsx','Plate 1 Transposed')
df_p3 <- read_excel('Exp 20250502 - AMTA with Imidazole Pt7.xlsx','Plate 1 Transposed')
name_df_p1 <- read_excel('Exp 20250409 - AMTA with Imidazole Pt4.xlsx','Sample Names')
name_df_p2 <- read_excel('Exp 20250411 - AMTA with Imidazole Pt5.xlsx','Sample Names')
name_df_p3 <- read_excel('Exp 20250502 - AMTA with Imidazole Pt7.xlsx','Sample Names')
#RENAME FIRST COLUMN
names(df_p1)[1]<-"Well_ID"
names(df_p2)[1]<-"Well_ID"
names(df_p3)[1]<-"Well_ID"
#MERGE NAMES_DF WITH MAIN DATAFRAME
df1_p1 <- cbind(name_df_p1, df_p1[!names(df_p1) %in% names(name_df_p1)])
df1_p2 <- cbind(name_df_p2, df_p2[!names(df_p2) %in% names(name_df_p2)])
df1_p3 <- cbind(name_df_p3, df_p3[!names(df_p3) %in% names(name_df_p3)])
#ADD A COLUMN FOR DATE OF EXPERIMENT
df1_p1_sub <- cbind(Time=rep("10 sec", nrow(df_p1)),
Plate=rep("1", nrow(df1_p1)),
df1_p1[1:5],
df1_p1[106:length(df1_p1)])
df1_p2_sub <- cbind(Time=rep("10 min", nrow(df1_p2)),
Plate=rep("2", nrow(df1_p2)),
df1_p2[1:3],
AMTA=rep("10", nrow(df1_p2)),
df1_p2[5],
df1_p2[106:length(df1_p2)])
df1_p3_sub <- cbind(Time=rep("10 min", nrow(df1_p3)),
Plate=rep("3", nrow(df1_p3)),
df1_p3)
df1_p3_sub$SampleType <- gsub("mM", "\\1", df1_p3_sub$SampleType)
colnames(df1_p3_sub)[6] <- "AMTA"
#COMBINE DATASETS
df2 <- rbind(df1_p1_sub, df1_p2_sub, df1_p3_sub)
#WHERE THE INDIVIDUAL SPECTRA ARE IN COLUMNS, STACK THE DATA
df3 <- melt(df2, id=c("Well_ID", "SampleName", "Conc", "AMTA", "Time","TechRep", "Plate"))
names(df3)[names(df3) == "variable"] <- "Wavelength"
df3$value = as.numeric(df3$value)
#EXTRACT WATER CONTROLS AND COMPUTE THE AVERAGE OF TECHREPS
df_waterControls <- df3 %>%
filter(SampleName == "Water Control") %>%
group_by(Plate, Wavelength) %>%
summarize_at(vars(value), list(MeanAbs = mean, SdAbs = sd))
#CALCULATE THE WATER (BLANK) CORRECTED ABSORBANCE VALUES
df4 <- inner_join(df3, df_waterControls, by=c("Plate", "Wavelength")) %>%
mutate(BC_value = value - MeanAbs) %>%
dplyr::select(Well_ID, SampleName, Conc, AMTA, Time, TechRep, Wavelength, value, BC_value) %>%
filter(SampleName == "Im")
#COMPUTE THE AVERAGE OF TECHREPS
df5 <- df4 %>%
group_by(SampleName, Conc, AMTA, Time, Wavelength) %>%
summarize_at(vars(BC_value), list(MeanAbs = mean, SdAbs = sd)) %>%
filter(Conc == 100)
df5$Wavelength <- as.numeric(as.character(df5$Wavelength))
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 14),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=13, width=13, units="cm")
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=14, width=14, units="cm")
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 13),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=13, width=13, units="cm")
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=13, width=13, units="cm")
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="left",
legend.position="bottom",
legend.text=element_text(size = 13),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification="right",
legend.position="bottom",
legend.text=element_text(size = 13),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=13, width=13, units="cm")
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification=c(0,1),
legend.position="bottom",
legend.text=element_text(size = 13),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=13, width=13, units="cm")
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification=c(0,0.5),
legend.position="bottom",
legend.text=element_text(size = 13),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=13, width=13, units="cm")
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=14, face="bold", hjust = 0.5),
legend.justification=c(0.5,0.5),
legend.position="bottom",
legend.text=element_text(size = 13),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 100 uM Im
ggplot(df5, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Time))) +
geom_line(aes(linetype=Time)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=13, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 12),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_brewer(palette="Blues", labels=c("1 mM", "10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_discrete(name = c("Reaction Time")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, reverse=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra.pdf", height=13, width=13, units="cm")
#COMPUTE THE AVERAGE OF TECHREPS
df6 <- df4 %>%
group_by(SampleName, Conc, AMTA, Time, Wavelength) %>%
summarize_at(vars(BC_value), list(MeanAbs = mean, SdAbs = sd)) %>%
filter(Conc %in% c(0,100) & Time == "10 min")
df6$Wavelength <- as.numeric(as.character(df6$Wavelength))
pal <- brewer.pal(3, "Blues")
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=13, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 12),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_manual(values = c(2,1), labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PLOT DATA - 0 and 100 uM Im
ggplot(df6, aes(x=Wavelength, y=MeanAbs, color=as.factor(AMTA), group=interaction(AMTA, Conc))) +
geom_line(aes(linetype=Conc)) +
labs(x = "Wavelength (nm)",
y = "Absorbance (a.u.)") +
scale_y_continuous(limits = c(-0.02,3)) +
theme_classic() +
theme(aspect.ratio=1,
axis.title=element_text(size=18),
axis.text=element_text(color = 1, size = 14),
legend.title=element_text(color=1, size=13, face="bold", hjust = 0.5),
legend.justification="center",
legend.position="bottom",
legend.text=element_text(size = 13),
panel.border = element_rect(colour = "black", fill=NA)) +
scale_color_manual(values = pal[2:3], labels=c("10 mM", "50 mM"), name=c("[AMTA]")) +
scale_linetype_manual(values = c(2,1), labels=c("0 \U003BCM", "100 \U003BCM"), name = c("[Imidazole]")) +
guides(color=guide_legend(bycol=TRUE, nrow = 1, title.position="top"),
linetype=guide_legend(bycol=TRUE, nrow = 1, title.position="top"))
#PRINT/SAVE IMAGES, CHANGE FILE NAMES AS APPROPRIATE
ggsave("Optimization_spectra2.pdf", height=13, width=13, units="cm")
